"""
KPL股票数据的Pydantic模型定义
用于数据验证和序列化
"""
from pydantic import BaseModel
from datetime import datetime


class KPLStockBase(BaseModel):
    """KPL股票基础模型"""
    stock_code: str
    stock_name: str
    change_percent: float = 0.0
    change_reason: str = ""
    limit_up_amount: float = 0.0
    circulation_market_value: float = 0.0
    selection_reason: str = ""
    turnover_amount: float = 0.0
    volume: float = 0.0
    turnover_rate: float = 0.0
    industry: str = ""
    data_date: datetime


class KPLStockCreate(KPLStockBase):
    """创建KPL股票数据模型"""
    pass


class KPLStockUpdate(KPLStockBase):
    """更新KPL股票数据模型"""
    pass


class KPLStockInDBBase(KPLStockBase):
    """数据库KPL股票数据基础模型"""
    id: int
    created_at: datetime
    updated_at: datetime
    
    class Config:
        from_attributes = True


class KPLStock(KPLStockInDBBase):
    """KPL股票数据模型"""
    pass